package com.wench.design.pattern.factory.before;

/**
 * @author wench
 */
public class CoffeeStore {

    public Coffee orderCoffee(String type) {
        Coffee coffee = null;
        String american = "american";
        String latte = "latte";
        if (american.equals(type)) {
            coffee = new AmericanCoffee();
        } else if (latte.equals(type)) {
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("很抱歉, 您点的 " + type + " 没有");
        }
        coffee.addSugar();
        coffee.addMilk();
        return coffee;
    }
}
